/*
*  Copyright 2019-2025 Zheng Jie
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package me.zhengjie.modules.account.rest;

import me.zhengjie.annotation.Log;

import lombok.RequiredArgsConstructor;
import java.util.List;

import me.zhengjie.modules.account.domain.AccountAc08;
import me.zhengjie.modules.account.domain.AccountAc50a5;
import me.zhengjie.modules.account.domain.dto.AccountAc08QueryCriteria;
import me.zhengjie.modules.account.service.AccountAc50a5Service;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.*;
import java.io.IOException;
import java.util.Map;
import javax.servlet.http.HttpServletResponse;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import me.zhengjie.utils.PageResult;

/**
* @author lzw
* @date 2025-06-09
**/
@RestController
@RequiredArgsConstructor
@Api(tags = "api")
@RequestMapping("/api/accountAc50a5")
public class AccountAc50a5Controller {

    private final AccountAc50a5Service accountAc50a5Service;

    @PostMapping("queryAccountAc50a5")
    public ResponseEntity<Object> queryAccountAc50a5(@Validated @RequestBody Map resources){

        return new ResponseEntity<>(accountAc50a5Service.query(resources),HttpStatus.OK);
    }

    @PostMapping
    @Log("新增api")
    @ApiOperation("新增api")
    @PreAuthorize("@el.check('accountAc50a5:add')")
    public ResponseEntity<Object> createAccountAc50a5(@Validated @RequestBody AccountAc50a5 resources) throws IOException {
        accountAc50a5Service.create(resources);
        return new ResponseEntity<>(HttpStatus.CREATED);
    }

    @PutMapping
    @Log("修改api")
    @ApiOperation("修改api")
    @PreAuthorize("@el.check('accountAc50a5:edit')")
    public ResponseEntity<Object> updateAccountAc50a5(@Validated @RequestBody AccountAc50a5 resources) throws IOException {
        accountAc50a5Service.update(resources);
        return new ResponseEntity<>(HttpStatus.NO_CONTENT);
    }

    @DeleteMapping
    @Log("删除api")
    @ApiOperation("删除api")
    @PreAuthorize("@el.check('accountAc50a5:del')")
    public ResponseEntity<Object> deleteAccountAc50a5(@ApiParam(value = "传ID数组[]") @RequestBody List<AccountAc50a5> ac50a5s) throws IOException {
        accountAc50a5Service.deleteAll(ac50a5s);
        return new ResponseEntity<>(HttpStatus.OK);
    }
}
